'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
  const {searchVal} = event
  const res =await db.collection("article")
    .aggregate()//聚合获取数据
	.match({
		title:new RegExp(searchVal)
	})//根据条件获取模糊查询数据
	.project({
		content:0,
	}).end()
	
	//返回数据给客户端
	return {
		code:0,
		data:res.data
	}
};
